Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
JasonMillward
approved these changes
May 27, 2025
ildyria
added a commit
that referenced
this pull request
May 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3367
Fixes stupid behaviour of Laravel again... Matthias would be proud. 😃
In theory we should use the
$request->hasCorrectSignature()method here. However, for some stupid unknown reason, the path value is added to the server Query String. This completely invalidates the signature check.For example the url
http://localhost:8000/image/small2x/c3/3d/c661c594a5a781cd44db06828783.png?expires=1748380289will be verified as :
http://localhost:8000/image/small2x/c3/3d/c661c594a5a781cd44db06828783.png?/image/small2x/c3/3d/c661c594a5a781cd44db06828783.png&expires=1748380289which makes the signature check fail as the hmac does not match.
Tested to work locally on my docker compose install.
Enhancements to secure image links:
SignatureExpiredException: Introduced a new exception classSignatureExpiredExceptionto handle cases where a secure link's signature has expired.SecurePathControllerto differentiate between invalid and expired signatures, logging detailed errors for invalid cases and throwing appropriate exceptions. Added private methodshasCorrectSignatureandsignatureHasNotExpiredto encapsulate these checks.pathToUrlmethod inHasUrlGeneratorto handle cases where signed URLs are not used, ensuring compatibility with secure image link configurations.Expanded test coverage:
testExpiredSignature) and broken signatures (testBrokenSignature) to validate the new exception and logic. Refactored existing tests to use helper methods for enabling secure and temporary links. [1] [2] [3]setSecureLinkandsetTemporaryLinkinSecureImageLinksTestto streamline test configuration and improve clarity.